﻿Imports TMySQL
Public Class frmTriggers
    Private _Table As IHasColumns
    Private _TriggerFormList As New List(Of frmTrigger)
    Public Sub New(ByVal ATable As IHasColumns)
        Me.New()
        _Table = ATable
        Init()
    End Sub

    Public Sub ApplyTextSettings(ByVal ASettings As TEditorSettings)
        For i As Integer = 0 To _TriggerFormList.Count - 1
            ASettings.Apply(_TriggerFormList(i).txtSource)
        Next
    End Sub

    Private Sub New()
        ' この呼び出しは、Windows フォーム デザイナで必要です。
        InitializeComponent()
        ' InitializeComponent() 呼び出しの後で初期化を追加します。
    End Sub

    Private Sub Init()
        _Table.RefreshTrigger()
        For i As Integer = 0 To _Table.TriggerCount - 1
            Dim tbs As New TabPage(_Table.Triggers(i).ActionTiming & " " & _Table.Triggers(i).ActionOrientation)
            pgc.TabPages.Add(tbs)
            Dim frmRet As New frmTrigger(_Table.Triggers(i))
            frmRet.Dock = DockStyle.Fill
            frmRet.TopLevel = False
            frmRet.Parent = tbs
            _TriggerFormList.Add(frmRet)
            frmRet.Show()
        Next
        frmMain.GridSettings.ApplyAll(Me)
        frmMain.GeneralSettings.ApplyAll(Me)
    End Sub

    Public Sub ApplyControlFontSettings(ByVal AControl As Control, ByVal ASettings As TGeneralSettings)
        For Each ctrl As Control In Me.Controls
            If ctrl.Controls.Count > 0 Then
                ApplyControlFontSettings(ctrl, ASettings)
            End If
            If Not ctrl.GetType Is GetType(Sgry.Azuki.WinForms.AzukiControl) Then
                ctrl.Font = ASettings.Font
                ctrl.BackColor = ASettings.BackColor
                ctrl.ForeColor = ASettings.ForeColor
            End If
        Next
    End Sub
End Class